package com.foreknow.test;

public class A {
    public void m1() {
        System.out.println("m1.......");
    }

    public void m2(String name) {
        System.out.println(name);
    }

    public int m3(int a,int b) {
       return a + b;
    }

    public void m4(int[] array) {
        for(int i = 0;i<array.length;i++) {
                System.out.println(array[i]);
        }
    }

    public int[] m5() {
        int[] array = {1,2,3};
        return array;
    }

    public void m6(Employee employee) {
        System.out.println(employee.getEid()+"--"+employee.getName());
    }

    public Employee m7() {
        Employee employee = new Employee();
        employee.setEid("10001");
        employee.setName("fender");
        return employee;
    }

    public Employee[] m8(Employee[] emps) {
        return emps;
    }
    public static void main(String[] args) {
        A a = new A();
        a.m1();
        a.m2("fender");
        int sum = a.m3(1,2);
        System.out.println(sum);
        int[] array = {1,2,3,4,5,6,7};
        a.m4(array);
        System.out.println("---------------------------------------");
        int[] aa = a.m5();
        for(int i = 0;i<aa.length;i++){
            System.out.println(aa[i]);
        }
        System.out.println("---------------------------------------");
        Employee emp = a.m7();
        System.out.println(emp.getEid()+"---"+emp.getName());
        System.out.println("---------------------------------------");


        Employee e1 = new Employee();
        e1.setEid("10000");
        e1.setName("fender");
        Employee e2 = new Employee();
        e2.setEid("10001");
        e2.setName("gibson");

        //将两个员工对象保存到数组容器中
        Employee[] emps = {e1,e2};
        //        emps[0] = e1;
        //        emps[1] = e2;

        Employee[] employees = a.m8(emps);
        for(int i = 0;i<employees.length;i++){
            //从数组中获取元素(通过下标)
            Employee e = employees[i];
            System.out.println(e.getEid()+"---"+e.getName());
        }
    }
}
